package com.atguigu.guli.service.trade.controller.api;


import com.atguigu.guli.service.base.result.R;
import com.atguigu.guli.service.trade.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/api/trade/order")
public class WeixinPayController {

    @Autowired
    OrderService orderService;

    //创建微信支付连接
    @GetMapping("/auth/weixin/{orderId}")
    public R createWeiPay(@PathVariable String orderId, HttpServletRequest request){
        //获取微信二维码
        R r = orderService.creatWeixinUrl(orderId,request);
        return r;
    }

    /*
    微信支付回调接口
     */
    @PostMapping("notifyurl")
    public String notifyurl(HttpServletRequest request){
        //获取微信二维码
        String info = orderService.notifyurl(request);
        return info;
    }
}
